package com.tianlaiedu.service.impl;

import com.tianlaiedu.bean.Labell;
import com.tianlaiedu.dao.LabellMapper;
import com.tianlaiedu.dao.PostMapper;
import com.tianlaiedu.service.LabellService;
import org.apache.ibatis.session.SqlSession;

/**
 * @author:hejing
 * @date:2021/12/1
 */
public class LabellServiceImpl implements LabellService {
    @Override
    public int addLabeel(Labell labell) {
        try(SqlSession sqlSession = com.tianlaiedu.utils.MapperUtil.getSqlSessionFactory().openSession(true)) {
            final LabellMapper labellMapper = sqlSession.getMapper(LabellMapper.class);
            return labellMapper.addLabeel(labell);
        }
    }

    @Override
    public Labell findByid(int id) {
        try(SqlSession sqlSession = com.tianlaiedu.utils.MapperUtil.getSqlSessionFactory().openSession(true)) {
            final LabellMapper labellMapper = sqlSession.getMapper(LabellMapper.class);
            return labellMapper.findByid(id);
        }
    }

    @Override
    public Labell findByname(String name) {
        try(SqlSession sqlSession = com.tianlaiedu.utils.MapperUtil.getSqlSessionFactory().openSession(true)) {
            final LabellMapper labellMapper = sqlSession.getMapper(LabellMapper.class);
            return labellMapper.findByname(name);
        }
    }
}
